package net.netca.gdltax.bpms.businessmanage.utilits;

import java.util.Calendar;

import javax.xml.datatype.XMLGregorianCalendar;

import net.netca.bmps.userservice.bo.CertInfo;
import net.netca.bmps.userservice.bo.CertInfoLocal;

public class Converter {
	public static void CertInfoConvert(CertInfoLocal certinfolocal, CertInfo certinfo){
		/*
		 *  private java.lang.String camame;
		    private byte[] enccert;
		    private java.lang.String encdigest;
		    private byte[] enckeypair;
		    private java.lang.Integer id;
		    private java.util.Calendar reqtime;
		    private byte[] signcert;
		    private java.lang.String signdigest;    
		    private X509PubKeyCertificate x509SignCert;    
			private X509PubKeyCertificate x509EncCert;
		 * */
		//certinfolocal.setCamame();
		certinfolocal.setId(certinfo.getId());
		certinfolocal.setEnccert(certinfo.getEnccert().getValue());
		certinfolocal.setEncdigest(certinfo.getEncdigest().getValue());
		certinfolocal.setEnckeypair(certinfo.getEnckeypair().getValue());
		certinfolocal.setSigncert(certinfo.getSigncert().getValue());
		certinfolocal.setSigndigest(certinfo.getSigndigest().getValue());
		if (certinfo.getReqno() != null && (certinfo.getReqno().getValue() != null)) {
			certinfolocal.setReqno(certinfo.getReqno().getValue());
		}
		
		
		XMLGregorianCalendar requesttime = certinfo.getReqtime();
		Calendar reqtime = Calendar.getInstance();
		reqtime.set(requesttime.getYear(), requesttime.getMonth(), requesttime.getDay(), requesttime.getHour(), requesttime.getMinute(), requesttime.getSecond());
		certinfolocal.setReqtime(reqtime);
	}
}
